package com.example.mybaseapp

import android.content.Intent
import android.os.Build
import android.os.Bundle
import android.widget.Toast
import androidx.activity.enableEdgeToEdge
import androidx.annotation.RequiresApi
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.AppCompatButton
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.example.lib_base.BaseActivity
import com.example.mybaseapp.databinding.ActivityMain2Binding
import com.example.mybaseapp.ui.AudioRecordActivity
import com.example.mybaseapp.ui.BaseRecyclerViewAdapterTestActivity
import com.example.mybaseapp.ui.CamerasActivity
import com.example.mybaseapp.ui.CircleSeekBarActivity
import com.example.mybaseapp.ui.DownLoadActivity
import com.example.mybaseapp.ui.FirstActivity
import com.example.mybaseapp.ui.FragmentTestActivity
import com.example.mybaseapp.ui.FuzzScopeActivity
import com.example.mybaseapp.ui.HalfCircleActivity
import com.example.mybaseapp.ui.LanguageActivity
import com.example.mybaseapp.ui.LiveDataActivity
import com.example.mybaseapp.ui.PackReceiverActivity
import com.example.mybaseapp.ui.PictureActivity
import com.example.mybaseapp.ui.SeondActivity
import com.example.mybaseapp.ui.ViewPagerActivity
import com.example.mybaseapp.ui.WebViewActivity
import com.example.mybaseapp.ui.contentproviderdemo.ContentProviderActivity
import com.example.mybaseapp.ui.datastore.DataStoreActivity
import com.example.mybaseapp.ui.floatingview.FloatintViewActivity
import com.example.mybaseapp.ui.flowtest.FlowTestActivity
import com.example.mybaseapp.ui.glide.GlideTestActivity
import com.example.mybaseapp.ui.jetpack.ViewModelActivity
import com.example.mybaseapp.ui.localbroadcastreceiver.LocalBroadcastReceiverActivity
import com.example.mybaseapp.ui.okhttptest.OkHttpTestActivity
import com.example.mybaseapp.ui.scale.ScaleActivity
import com.therouter.TheRouter
import com.therouter.router.Route

@Route(path = "app/home")
class MainActivity : BaseActivity<ActivityMain2Binding>() {
    //<editor-fold desc="这里需要付费观看">

    override fun onViewInit() {
        initView()
    }

    //</editor-fold>
//    region haoyan
    private fun initView() {
        findViewById<AppCompatButton>(R.id.btn1).setOnClickListener {
//            startActivity(Intent(this@MainActivity, FirstActivity::class.java))
//            TheRouter.build("app/FirstActivity").navigation();
        }
        findViewById<AppCompatButton>(R.id.btn2).setOnClickListener {
            startActivity(Intent(this@MainActivity, SeondActivity::class.java))
        }
        findViewById<AppCompatButton>(R.id.btn_half_circle).setOnClickListener {
            startActivity(Intent(this@MainActivity, HalfCircleActivity::class.java))
        }
        findViewById<AppCompatButton>(R.id.btn_rotate).setOnClickListener {
            startActivity(Intent(this@MainActivity, CircleSeekBarActivity::class.java))
        }
        findViewById<AppCompatButton>(R.id.btn_download).setOnClickListener {
            startActivity(Intent(this@MainActivity, DownLoadActivity::class.java))
        }
        findViewById<AppCompatButton>(R.id.btn_viewpager).setOnClickListener {
            startActivity(Intent(this@MainActivity, ViewPagerActivity::class.java))
        }
        findViewById<AppCompatButton>(R.id.btn_serail).apply{
            setOnClickListener{
//                Toast.makeText(this@MainActivity,"序列号：${Build.SERIAL}",Toast.LENGTH_SHORT).show()
                startActivity(Intent(this@MainActivity, LiveDataActivity::class.java))
            }
        }
        findViewById<AppCompatButton>(R.id.btn_pack_reveiver).apply{
            setOnClickListener{
                startActivity(Intent(this@MainActivity, PackReceiverActivity::class.java))
            }
        }
        findViewById<AppCompatButton>(R.id.btn_scale).apply{
            setOnClickListener{
                startActivity(Intent(this@MainActivity, ScaleActivity::class.java))
            }
        }

        findViewById<AppCompatButton>(R.id.btn_camera).apply{
            setOnClickListener{
                startActivity(Intent(this@MainActivity, CamerasActivity::class.java))
            }
        }
        findViewById<AppCompatButton>(R.id.btn_webview).apply{
            setOnClickListener{
                startActivity(Intent(this@MainActivity, WebViewActivity::class.java))
            }
        }
        findViewById<AppCompatButton>(R.id.btn_record_audio).apply{
            setOnClickListener{
                startActivity(Intent(this@MainActivity, AudioRecordActivity::class.java))

            }
        }
        findViewById<AppCompatButton>(R.id.btn_fuzzy_scope).apply{
            setOnClickListener{
                startActivity(Intent(this@MainActivity, FuzzScopeActivity::class.java))
            }
        }
        findViewById<AppCompatButton>(R.id.btn_language).apply{
            setOnClickListener{
                startActivity(Intent(this@MainActivity, LanguageActivity::class.java))
            }
        }
        findViewById<AppCompatButton>(R.id.btn_picture).apply{
            setOnClickListener{
                startActivity(Intent(this@MainActivity, PictureActivity::class.java))
            }
        }
        findViewById<AppCompatButton>(R.id.btn_fragment).apply{
            setOnClickListener{
                startActivity(Intent(this@MainActivity, FragmentTestActivity::class.java))
            }
        }
        findViewById<AppCompatButton>(R.id.btn_baseadapter_test).apply{
            setOnClickListener{
                startActivity(Intent(this@MainActivity, BaseRecyclerViewAdapterTestActivity::class.java))
            }
        }
        findViewById<AppCompatButton>(R.id.btn_localbroadcast).apply{
            setOnClickListener{
                startActivity(Intent(this@MainActivity, LocalBroadcastReceiverActivity::class.java))
            }
        }
        findViewById<AppCompatButton>(R.id.btn_contentprovider).apply{
            setOnClickListener{
                startActivity(Intent(this@MainActivity, ContentProviderActivity::class.java))
            }
        }
        findViewById<AppCompatButton>(R.id.btn_floatingview).apply{
            setOnClickListener{
                startActivity(Intent(this@MainActivity, FloatintViewActivity::class.java))
            }
        }
        findViewById<AppCompatButton>(R.id.btn_flow_test).apply{
            setOnClickListener{
                startActivity(Intent(this@MainActivity, FlowTestActivity::class.java))
            }
        }
        findViewById<AppCompatButton>(R.id.btn_okhttp_test).apply{
            setOnClickListener{
                startActivity(Intent(this@MainActivity, OkHttpTestActivity::class.java))
            }
        }
        findViewById<AppCompatButton>(R.id.btn_glide).apply{
            setOnClickListener{
                startActivity(Intent(this@MainActivity, GlideTestActivity::class.java))
            }
        }
        findViewById<AppCompatButton>(R.id.btn_viewmodel).apply{
            setOnClickListener{
                startActivity(Intent(this@MainActivity, ViewModelActivity::class.java))
            }
        }
        findViewById<AppCompatButton>(R.id.btn_datastore).apply{
            setOnClickListener{
                startActivity(Intent(this@MainActivity, DataStoreActivity::class.java))
            }
        }
        binding.btnTherouter.setOnClickListener {
            Toast.makeText(this@MainActivity,"点击了",Toast.LENGTH_SHORT).show()

//            TheRouter.build("common/CommonMainActivity")
//                .withInt("intValue", 12345678)
//                .withString("str_123_Value", "传中文字符串")
//                .withBoolean("boolValue", true)
//                .withLong("longValue", 123456789012345L)
//                .withChar("charValue", 'c')
//                .withDouble("double", 3.14159265358972)
//                .withFloat("floatValue", 3.14159265358972F)
//                .navigation();

            TheRouter.build("common/CommonMainActivity").navigation();
        }
    }
//    endregion
}